home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2004 July & August
/
PCWorld_2004-07-08_cd.bin
/
Software
/
topware
/
sandra
/
san2004.SP1-9104-Win32-SSO.exe
/
{app}
/
examples
/
Oracle Schema.sql
< prev
next >
Wrap
Text File
|
2003-12-16
|
4KB
|
162 lines
--
-- Oracle 7.3.3.x.x/8.0.4.x.x Schema for Sandra Report
--
-- Schema is assumed to have been created already.
-- No extents included, please add as required.
--
-- Copyright 1995-2004, C. A. Silasi, SiSoftware.
-- All Rights Reserved.
--
-- Kill all tables
--
DROP TABLE Item;
DROP TABLE ItemGroup;
DROP TABLE Device;
DROP TABLE Class;
DROP TABLE Module;
DROP TABLE Report;
DROP TABLE IDCount;
--
-- Kill all sequences
--
DROP SEQUENCE seqItem;
DROP SEQUENCE seqItemGroup;
DROP SEQUENCE seqDevice;
DROP SEQUENCE seqClass;
DROP SEQUENCE seqModule;
DROP SEQUENCE seqReport;
--
-- Create new sequences
--
CREATE SEQUENCE seqItem MINVALUE 1 MAXVALUE 1000000000 CYCLE;
CREATE SEQUENCE seqItemGroup MINVALUE 1 MAXVALUE 1000000000 CYCLE;
CREATE SEQUENCE seqDevice MINVALUE 1 MAXVALUE 1000000000 CYCLE;
CREATE SEQUENCE seqClass MINVALUE 1 MAXVALUE 1000000000 CYCLE;
CREATE SEQUENCE seqModule MINVALUE 1 MAXVALUE 1000000000 CYCLE;
CREATE SEQUENCE seqReport MINVALUE 1 MAXVALUE 1000000000 CYCLE;
--
-- Create new tables
--
CREATE TABLE Report (
ID INTEGER PRIMARY KEY,
ProgramName VARCHAR2(255),
ProgramVersion VARCHAR2(255),
RegisteredUser VARCHAR2(255),
RegisteredCompany VARCHAR2(255),
LicenceStatus VARCHAR2(255),
LicenceExtra VARCHAR2(255),
UserID VARCHAR2(255),
HostName VARCHAR2(255),
SystemID VARCHAR2(255),
WebUserID VARCHAR2(255),
RunID VARCHAR2(255),
RunDate DATE DEFAULT SYSDATE,
Completed NUMBER(1) NOT NULL
);
CREATE TABLE Module (
ID INTEGER PRIMARY KEY,
ReportID INTEGER REFERENCES Report(ID),
Name VARCHAR2(255) NOT NULL,
TypeID INTEGER NOT NULL,
HasClass NUMBER(1) NOT NULL,
HasDevice NUMBER(1) NOT NULL,
HelpID INTEGER NOT NULL
);
CREATE TABLE Class (
ID INTEGER PRIMARY KEY,
ModuleID INTEGER REFERENCES Module(ID),
Name VARCHAR2(255) NOT NULL,
TypeID INTEGER NOT NULL,
HelpID INTEGER NOT NULL
);
CREATE TABLE Device (
ID INTEGER PRIMARY KEY,
ModuleID INTEGER REFERENCES Module(ID),
ClassID INTEGER,
Name VARCHAR2(255) NOT NULL,
TypeID INTEGER NOT NULL,
HelpID INTEGER NOT NULL
);
CREATE TABLE ItemGroup (
ID INTEGER PRIMARY KEY,
ModuleID INTEGER REFERENCES Module(ID),
ClassID INTEGER,
DeviceID INTEGER,
Name VARCHAR2(255) NOT NULL,
TypeID INTEGER NOT NULL,
HelpID INTEGER NOT NULL
);
CREATE TABLE Item (
ID INTEGER PRIMARY KEY,
ModuleID INTEGER REFERENCES Module(ID),
GroupID INTEGER,
Name VARCHAR2(255) NOT NULL,
DataValue VARCHAR2(255),
IconID INTEGER NOT NULL,
TypeID INTEGER NOT NULL,
HelpID INTEGER NOT NULL
);
CREATE TABLE IDCount (
TableName VARCHAR2(10) PRIMARY KEY,
CurrentID INTEGER NOT NULL
);
--
-- Set-up keys/indexes
--
CREATE INDEX ndxUserID ON Report(UserID);
CREATE INDEX ndxSystemID ON Report(SystemID);
CREATE INDEX ndxWebUserID ON Report(WebUserID);
CREATE INDEX ndxModuleName ON Module(Name);
CREATE INDEX ndxItemName ON Item(Name);
--
-- Inserts
--
INSERT INTO IDCount (TableName, CurrentID) VALUES ('Item', 1);
INSERT INTO IDCount (TableName, CurrentID) VALUES ('ItemGroup', 1);
INSERT INTO IDCount (TableName, CurrentID) VALUES ('Device', 1);
INSERT INTO IDCount (TableName, CurrentID) VALUES ('Class', 1);
INSERT INTO IDCount (TableName, CurrentID) VALUES ('Module', 1);
INSERT INTO IDCount (TableName, CurrentID) VALUES ('Report', 1);